<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>在线OJ-题目列表</title>
    <style>
        /* 全局样式重置 */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        html,
        body {
            width: 100%;
            height: 100%;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: linear-gradient(135deg, #e0f7fa, #b2ebf2);
        }

        /* 导航栏样式 */
       .container .navbar {
            width: 100%;
            height: 60px;
            background-color: #006064;
            display: flex;
            align-items: center;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        }

       .container .navbar a {
            width: 100px;
            color: white;
            font-size: 18px;
            line-height: 60px;
            text-decoration: none;
            text-align: center;
            transition: background-color 0.3s ease;
        }

       .container .navbar a:hover {
            background-color: #00838f;
        }

       .container .navbar .login {
            margin-left: auto;
        }

        /* 题目列表区域样式 */
       .container .question_list {
            width: 90%;
            max-width: 800px;
            margin: 0 auto;
            text-align: center;
            padding-top: 50px;
            background-color: rgba(255, 255, 255, 0.9);
            border-radius: 20px;
            box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
            margin-top: 50px;
            padding: 40px;
        }

       .container .question_list h1 {
            color: #006064;
            font-size: 32px;
            margin-bottom: 30px;
        }

       .container .question_list table {
            width: 100%;
            border-collapse: collapse;
            font-size: 16px;
        }

       .container .question_list table th,
       .container .question_list table td {
            padding: 15px;
            border-bottom: 1px solid #ddd;
        }

       .container .question_list table th {
            background-color: #006064;
            color: white;
            font-weight: 600;
        }

       .container .question_list table tr:nth-child(even) {
            background-color: #f2f2f2;
        }

       .container .question_list table tr:hover {
            background-color: #e0f7fa;
        }

       .container .question_list table .item a {
            text-decoration: none;
            color: #006064;
            transition: color 0.3s ease;
        }

       .container .question_list table .item a:hover {
            color: #00838f;
            text-decoration: underline;
        }

        /* 翻页按钮样式 */
       .pagination {
            margin-top: 20px;
            display: flex;
            justify-content: center;
        }

       .pagination button {
            padding: 10px 20px;
            margin: 0 5px;
            background-color: #006064;
            color: white;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            transition: background-color 0.3s ease;
        }

       .pagination button:hover {
            background-color: #00838f;
        }

       .pagination button:disabled {
            background-color: #ccc;
            cursor: not-allowed;
        }

        /* 页脚样式 */
       .container .footer {
            width: 100%;
            text-align: center;
            color: #666;
            margin-top: 30px;
            padding: 20px 0;
        }

       .container .footer h4 {
            font-weight: normal;
        }
    </style>
</head>

<body>
    <div class="container">
        <!-- 导航栏， 功能不实现-->
        <div class="navbar">
            <a href="/">首页</a>
            <a href="/List">题库</a>
            <a href="/none.html">竞赛</a>
            <a href="/none.html">讨论</a>
            <a href="/none.html">求职</a>
            <a class="login" href="/none.html">登录</a>
        </div>
        <div class="question_list">
            <h1>题目列表</h1>
            <table id="questionTable">
                <tr>
                    <th class="item">编号</th>
                    <th class="item">标题</th>
                    <th class="item">难度</th>
                </tr>
                <!-- 这里假设题目数据是动态填充的，实际应用中可以通过后端渲染或前端 JavaScript 动态添加 -->
                {{#question}}
                <tr>
                    <td class="item"><a href="/Question/{{id}}">{{id}}</a></td>
                    <td class="item">{{title}}</td>
                    <td class="item">{{level}}</td>
                </tr>
                {{/question}}
            </table>
            <div class="pagination">
                <button id="prevPage" onclick="prevPage()">上一页</button>
                <button id="nextPage" onclick="nextPage()">下一页</button>
            </div>
        </div>
        <div class="footer">
            <h4>@A-clear-meaning</h4>
        </div>
    </div>
    <script>
        // 假设每页显示 1 条题目
        const itemsPerPage = 5;
        // 获取表格的所有行（不包括表头）
        const rows = Array.from(document.querySelectorAll('#questionTable tr')).slice(1);
        // 当前页码，初始为 1
        let currentPage = 1;
        // 总页数
        const totalPages = Math.ceil(rows.length / itemsPerPage);

        function showPage(page) {
            // 计算当前页的起始和结束索引
            const startIndex = (page - 1) * itemsPerPage;
            const endIndex = startIndex + itemsPerPage;

            // 隐藏所有行
            rows.forEach(row => row.style.display = 'none');
            // 显示当前页的行
            for (let i = startIndex; i < endIndex && i < rows.length; i++) {
                rows[i].style.display = 'table-row';
            }

            // 更新按钮状态
            document.getElementById('prevPage').disabled = page === 1;
            document.getElementById('nextPage').disabled = page === totalPages;
        }

        function prevPage() {
            if (currentPage > 1) {
                currentPage--;
                showPage(currentPage);
            }
        }

        function nextPage() {
            if (currentPage < totalPages) {
                currentPage++;
                showPage(currentPage);
            }
        }

        // 初始化显示第一页
        showPage(currentPage);
    </script>
</body>

</html>